<template>
  <div>
    <div>
      <video :src="this.video_url" controls></video>
      <div class="movie-info">
        <div class="info-title">{{ this.video_list.title }}</div>
        <div class="info-content">
          <img :src="this.video_list.user.avatarurl" alt="" class="c-pic" />
          <div class="c-text">{{ this.video_list.user.nickName }}</div>
          <img src="../../../assets/video-end.png" alt="" class="c-icon" v-show="this.video_list.user.nickName =='猫眼电影'" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "videoplay",
  data() {
    return {
      id: "",
      last_list: [],
      video_list: [],
      video_url: "",
      video_item: "",
      end_url: "",
      full_url: "",
    };
  },
  mounted() {
    this.id = this.$route.params.id;
    this.end_url = this.$route.params.url;
    console.log(this.id);
    this.full_url = "./json/" + this.end_url;
    console.log(this.full_url);
    axios.get(this.full_url).then((res) => {
      console.log(res, "推荐页");
      this.last_list = res.data.data.feeds;
      console.log(this.last_list);
      this.video_list = this.last_list.find((item) => {
        console.log(item.video.id);
        return item.video.id == this.id;
      });
      console.log(this.video_list);
      this.video_item = this.video_list.video;
      this.video_url = this.video_item.url;
    });
  },
};
</script>

<style scoped lang="less">
video {
  width: 100%;
  height: 230px;
}
.movie-info{
  padding: 15px;
}
.info-title {
  font-size: 16px;
  color: #333;
  line-height: 22px;
}
.info-content {
  display: flex;
  padding-top: 3px;
  .c-pic {
    display: inline-block;
    width: 25px;
    height: 25px;
    border-radius: 50%;
  }
  .c-text{
    padding-left: 5px;
  }
  .c-icon {
    display: inline-block;
    width: 12px;
    height: 12px;
  }
}
</style>